<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
{{import os
if os.path.exists(os.path.join(request.folder,'static','calendar.js')):}}
<link rel="stylesheet" href="/{{=request.application}}/static/calendar.css" type="text/css" media="screen" title="core css file" charset="utf-8" />
<script src="/{{=request.application}}/static/calendar.js" type="text/javascript" charset="utf-8"></script>
{{pass}}
<script type="text/javascript"><!--
/* Written by Massimo Di Pierro. Here for backward compatibility. */
function popup(url) {
  newwindow=window.open(url,'name','height=400,width=600');
  if (window.focus) newwindow.focus();
  return false;
}
function collapse(id) { $('#'+id).slideToggle(); }
function fade(id,value) { if(value>0) $('#'+id).hide().fadeIn('slow'); else $('#'+id).show().fadeOut('slow'); }
function ajax(u,s,t) {
  var query="";
  for(i=0; i<s.length; i++) { if(i>0) query=query+"&";
     query=query+encodeURIComponent(s[i])+"="+encodeURIComponent(document.getElementById(s[i]).value);
  }
  $.ajax({type: "POST", url: u, data: query, success: function(msg) { document.getElementById(t).innerHTML=msg; } });  
} 
String.prototype.reverse = function () {return this.split('').reverse().join('');};
$(document).ready(function() {
$('div.error').hide().slideDown('slow');
$('#flash').hide().slideDown('slow')
$('#flash').click(function() { $(this).fadeOut('slow'); return false; });
$('input.integer').keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
$('input.double').keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-\.]|[\-](?=.)|[\.](?=[0-9]*[\.])/g,'').reverse();});
try {$("input.date").focus( function() {Calendar.setup({
     inputField: this.id,
     ifFormat: "{{=T('%Y-%m-%d')}}",
     showsTime: false
}); }); } catch(e) {};
try { $("input.datetime").focus( function() {Calendar.setup({
     inputField: this.id,
     ifFormat: "{{=T('%Y-%m-%d %H:%M:%S')}}",
     showsTime: true,
     timeFormat: "24"
}); }); } catch(e) {};
try { $("input.time").clockpick({
     starthour : 0,
     endhour : 23,
     showminutes : true,
     military : true
}); } catch(e) {};
});
//--></script>